package com.numbfish.ch02_ex01_aop;

import com.numbfish.ch02_ex01_aop.config.CustomConfig;
import com.numbfish.ch02_ex01_aop.pojo.Person;
import com.numbfish.ch02_ex01_aop.service.MyCalculator;
import com.numbfish.ch02_ex01_aop.service.MyCalculatorAnnotation;
import lombok.extern.slf4j.Slf4j;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.Arrays;

@SpringBootTest
@Slf4j

public class Ch02Ex01AopTestApp {
    @Autowired
    private  ApplicationContext applicationContext;

    @Autowired
    private MyCalculator myCalculator;

    @Autowired
    private MyCalculatorAnnotation myCalculatorAnnotation;
    @Test
    void contextLoads() {
        log.info("applicationContext = {}",applicationContext);
    }
    @Test
    void test1(){
        MyCalculator calculator = new MyCalculator();
        Integer div = calculator.div(10, 5);
        System.out.println(div);
    }
    @Test
    void test2(){
        myCalculator.div(3,2);
    }

    @Test
    void test3(){
        myCalculatorAnnotation.div(3,1);
    }
}